﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WpfApp1.Model
{
    public class MultiBindingConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values != null && values.Length == 2)
            {
                var result1 = int.TryParse(values[0].ToString(), out int age);
                var result2 = double.TryParse(values[1].ToString(), out double money);
                if (age < 20 && money < 100)
                {
                    return "没钱的年轻人";
                }
                else if (age<50&& money > 200)
                {
                    return "有钱的中年人";
                }
                else
                {
                    return "啥也不是";
                }
            }
            return "";
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
